;An Addon for mIRC v7 By Yochai Timmer
;IP Tracer V1.2
;I've made this script mainly because it annoyed me when I kept seeing people with their IP as the host in the User@Host
;This script will Trace their IP, Save it to a .txt file in the mirc's main directory, and load the results in to a @window.
;The script will also work on /dns commands...
;To load the aliases: 
; /load -rs IP-tracer.mrc
;Syntax:
; /iptracer IP Nick
;Example:
; /iptracer 32.96.111.130 FBI

; It won't always trace till the end.. cause It just uses the Microsoft IP Tracer... And as the name Indicates... It's Microsoft...
; The script opens a Dos Window... DON'T CLOSE IT ! Wait for it to close by itself.. The window is the samn Microsoft program tracing the IP.

on *:DNS: {
  if ($nick) IPTracer $iaddress $nick
  elseif ($raddress) IPTracer $iaddress $raddress
  elseif ($iaddress) IPTracer $iaddress IP= $+ $iaddress
}
alias IPTracer { 
  if ( $0 > 1 ) {
    run command.com /c tracert $1 > $mircdirTrace- $+ $2- $+ .txt
    .timer 0 10 IpCheck.Thing $1-
  }
  else echo -a 12You MUST enter the IP and then a Nick
}
alias IpCheck.Thing {
  var %temp.thing = $read -l $+ $lines( [ $mircdirTrace- [ $+ [ $2- [ $+ .txt ] ] ] ] ) $mircdirTrace- $+ $2- $+ .txt 
  if ( %temp.thing == Trace complete. ) {
    window -xk0 +tbsx @ $+ $2-
    loadbuf @ $+ $2- $mircdirTrace- [ $+ [ $2- [ $+ .txt ] ] ] ] ] ]
    var %count.thing = 0
    :start 
    inc %count.thing
    if ( $timer(%count.thing).com == IpCheck.Thing $1- ) {
      .timer $+ $timer(%count.thing) off
      .remove $mircdirTrace- [ $+ [ $2- [ $+ .txt ] ] ] ] ] ]
      halt
    }
    if (%count.thing != $timer(0) ) goto start
  }
}

